import org.junit.Test;

import java.awt.*;
import java.awt.event.KeyEvent;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by liuhuan on 2016/11/22.
 */
public class RobotDemo {

    @Test
    public void robot() throws AWTException, InterruptedException {
        Robot robot = new Robot();
        robot.setAutoDelay(100);

        while (true) {

            System.out.println("===========================【" +
                    new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "】");

            robot.keyPress(KeyEvent.VK_ALT);
            robot.keyRelease(KeyEvent.VK_ALT);
            Thread.currentThread().sleep(3 * 60 * 1000);
        }

    }
}
